<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="m" uri="/cutm_tags"%>
<html>
<head>
<title>配音管理</title>
<link rel="stylesheet" href="<s:url value="/common/css/nyroModal.css"/>" type="text/css" />
<script type="text/javascript"	src="<s:url value="/common/scripts/jquery.nyroModal-1.5.5.js"/>"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('#peiyinform').vaildAjax(function(data){
		if(data!=''){
			$('#cancal').click();
			BaseJs.alert('配音成功');
		}
	});
	$('#voiceSave').click(function(){
		var id=$('#peiyinform>input[name="manuscript.id"]').val();
		$('#t3d'+id).text($('#manuscriptTimeLong').val());
		$('#t4d'+id).text($('#NocurUser').text());
		$('#peiyinform').submit();
	});
	$('.toVoice').click(function(){
		var vid = $(this).val();
		var time = $(this).attr('time');
		$.urlAjax('voice/EditVoice!getContent?id='+vid,function(data){
			$('#contentArea').text(data);
			$('input[name=manuscript.id]').val(vid);
			$('input[name=manuscript.timeLong]').val(time);
		});
		$("#topop").trigger("click");
	});
});
</script>
</head>
<body>
<s:form action="voice/EditVoice" method="get">
	<h2 class="title">请输入查询条件</h2>
	<table class="form">
		<tr>
			<th width="20%">创建时间</th>
			<td width="40%"><m:date name="beginDate" />-<m:date name="endDate" /></td>
			<th width="20%">所属栏目</th>
			<td width="20%"><m:select enumType="program.type" headKey="----请选择----" headValue="-1" name="manuscript.column" /></td>
		</tr>
		<tr>
			<th width="20%">标题</th>
			<td width="40%"><s:textfield name="manuscript.title" /></td>
			<th width="20%">撰稿人</th>
			<td width="20%"><m:dropUser name="manuscript.user.id" headKey="--请选择--" headValue=""/></td>
		</tr>
	</table>
	<div class="btnGroup"><s:submit value="确定" /></div>
</s:form>
<s:if test="manuscripts!=null">
	<h2 class="title">需要配音的节目列表</h2>
	<table class="list">
		<tr>
			<th width="10%">配音</th>
			<th width="35%">标题</th>
			<th width="10%">撰稿人</th>
			<th width="10%">栏目</th>
			<th width="10%">配音时长(秒)</th>
			<th width="5%">配音人</th>
			<th width="10%">撰稿日期</th>
			<th width="10%">稿件类型</th>
		</tr>
		<s:iterator value="manuscripts.items">
			<tr id="exp${id}">
				<td>
				<s:if test="(puser==null)||(#session.curUser.id==puser.id)">
					<input type="radio" value="${id}" time='<s:property value="timeLong"/>' class="toVoice" />
				</s:if>
				</td>
				<td><s:property value="title" /> </td>
				<td><s:property value="user.name" /></td>
				<td><m:property value="column"/></td>
				<td id="t3d${id}"><s:if test="timeLong==null">未配音</s:if><s:else><s:property value="timeLong"/></s:else></td>
				<td id="t4d${id}"><s:property value="puser.name"/></td>
				<td><s:date name="createDate" format="yyyy-MM-dd" /></td>
				<td><s:if test="urgent">急稿</s:if><s:else>普稿</s:else></td>
			</tr>
		</s:iterator>
	</table>
	<m:page value="${manuscripts}" showSeaBar="true" />
</s:if>
<a href="#voiceDiv" class="nyroModal" rev="modal" id="topop"></a>
<div id="voiceDiv" style="display: none;width: 800px;">
	<s:form id="peiyinform" action="voice/EditVoice!voice">
		<s:hidden name="manuscript.id" />
		<table class="form">
			<tr>
				<td colspan="5">
					<s:textarea name="com"  id="contentArea" cssStyle="height:500px;font-size:14px;color:black;" readonly="true"></s:textarea>
				</td>
			</tr>
			<tr>
				<th width="20%">配音时长(单位:秒)</th>
				<td width="20%"><s:textfield id="manuscriptTimeLong" name="manuscript.timeLong" cssClass="rule[number]" cssStyle="width:100px;" /></td>
				<th width="15%">配音人</th>
				<td width="15%" id="NocurUser"><s:property value="#session.curUser.name" /></td>
				<td width="30%"><input type="button" id="voiceSave" value="保存" /><input type="button" id="cancal" class="nyroModalClose" value="取消" />	</td>
			</tr>
		</table>
	</s:form>
</div>
</body>
</html>